/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package alcatelparser.modules;

import alcatelparser.tags.*;

import java.util.LinkedList;

/**
 *
 * @author geniuz
 */
public class TagOrder {
    public TagOrder()
    {
        initTagOrder();
    }

    private void initTagOrder()
    {
        _aList = new LinkedList();
        _aList.add(new CDRFileTag());
        _aList.add(new HeaderTag());
        _aList.add(new StartDateTimeTag());
        _aList.add(new ExchangeInfoHeaderTag());
        _aList.add(new ExchangeIDTag());
        _aList.add(new SoftwareVersionTag());
        _aList.add(new PStringTag());
        _aList.add(new ReasonForOutputTag());
        _aList.add(new BodyTag());
        _aList.add(new RecordContentTag());
        _aList.add(new AdditionalRecordTypesTag());
        _aList.add(new MarketSpecificRecordType1());
        _aList.add(new MarketSpecificRecordType2());
        _aList.add(new MarketSpecificRecordType3());
        _aList.add(new MarketSpecificRecordType4());
        _aList.add(new MarketSpecificRecordType5());
        _aList.add(new RecordTypeTag());
        _aList.add(new StartTimeStampTag());
        _aList.add(new ParticipantInfoTag());
        _aList.add(new BearerServiceTag());
        _aList.add(new ServiceUserTag());
        _aList.add(new CallIdentificationNumberTag());
        _aList.add(new SupplementaryServicesTag());
        _aList.add(new ImmediateNotificationTag());
        _aList.add(new CauseTag());
        _aList.add(new INSpecificInfoTag());
        _aList.add(new PartialGenerationTag());
        _aList.add(new ExchangeInfoTag());
        _aList.add(new AdditionalParticipantInfoTag());
        _aList.add(new CallingPartyCategoryTag());
        _aList.add(new CallingPartyTypeTag());
        _aList.add(new ChargingInformationTag());
        _aList.add(new AccessDeliveryTag());
        _aList.add(new TrunkGroupOutgoingTag());
        _aList.add(new TrunkGroupIncomingTag());
        _aList.add(new FallBackBearerServiceTag());
        _aList.add(new TeleserviceTag());
        _aList.add(new CallDurationTag());
        _aList.add(new UUInfoTag());
        _aList.add(new RecordExtensionsTag());
        _aList.add(new RecordSequenceNumberTag());
        _aList.add(new DataValidityTag());
        _aList.add(new RecordEndTag());
    }

    public final LinkedList getList()
    {
        return _aList;
    }

    public final int getNextTag(ITagParser itagparser)
    {
        int i = _aList.indexOf(itagparser);
        for(i++; i < _aList.size(); i++)
            if(!((ITagParser)_aList.get(i)).isChoiceTag())
                return i;

        return -1;
    }

    public final ITagParser getTag(int i)
    {
        return (ITagParser)_aList.get(i);
    }

    public final int getTagIndex(ITagParser itagparser)
    {
        return _aList.indexOf(itagparser);
    }

    private LinkedList _aList;
}
